﻿using System.Collections.Generic;
using System.Linq;
using Microsoft.WowAddonStudio.Project.Import;
using Microsoft.WowAddonStudio.Project.Import.Ace;
using NUnit.Framework;

namespace WowProjectPackage.Tests.Import.Ace
{
	/// <summary>
	/// Implements ace import unit tests.
	/// </summary>
	[TestFixture]
	public class AceImportPluginTest : ImporterBaseTest
	{
		private AceImportPlugin importer;

		[SetUp]
		public override void SetUp()
		{
			base.SetUp();
			importer = new AceImportPlugin();
		}

		[TearDown]
		public override void TearDown()
		{
			base.TearDown();
		}

		/// <summary>
		/// Tests the in flight import.
		/// </summary>
		[Test]
		public void TestInFlightImport()
		{
			var settings = new AceImportSettings(inFlightUri);
			IEnumerable<IAddonItem> addonItems = importer.Import(settings);
			Assert.AreEqual(addonItems.Count(), 13);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.Code), 6);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.Frame), 2);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.TableOfContents), 3);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.None), 2);
		}

		/// <summary>
		/// Tests the shaman warning import.
		/// </summary>
		[Test]
		public void TestShamanWarningImport()
		{
			var settings = new AceImportSettings(shamanWarningUri);
			IEnumerable<IAddonItem> addonItems = importer.Import(settings);
			Assert.AreEqual(addonItems.Count(), 21);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.Code), 7);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.Frame), 0);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.TableOfContents), 7);
			Assert.AreEqual(addonItems.Count(addonItem => addonItem.Type == FileType.None), 7);
		}

		//TODO: Add acceptance criteria tests...
	}
}